{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from sklearn.preprocessing import LabelEncoder, MinMaxScaler\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.metrics import log_loss, roc_auc_score\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tensorflow as tf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Using TensorFlow version 1.9.0\n",
      "\n"
     ]
    }
   ],
   "source": [
    "\n",
    "tf.logging.set_verbosity(tf.logging.INFO) # Set to INFO for tracking training, default is WARN. ERROR for least messages\n",
    "print(\"Using TensorFlow version %s\\n\" % (tf.__version__))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "from deepctr.models import DeepFM\n",
    "from deepctr.utils import SingleFeat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "CONTINUOUS_COLUMNS =  [\"I\"+str(i) for i in range(1,14)] # 1-13 inclusive\n",
    "CATEGORICAL_COLUMNS = [\"C\"+str(i) for i in range(1,27)] # 1-26 inclusive\n",
    "LABEL_COLUMN = [\"clicked\"]\n",
    "\n",
    "TRAIN_DATA_COLUMNS = LABEL_COLUMN + CONTINUOUS_COLUMNS + CATEGORICAL_COLUMNS\n",
    "# TEST_DATA_COLUMNS = CONTINUOUS_COLUMNS + CATEGORICAL_COLUMNS\n",
    "\n",
    "FEATURE_COLUMNS = CONTINUOUS_COLUMNS + CATEGORICAL_COLUMNS"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.read_csv('./data/train.csv',names=TRAIN_DATA_COLUMNS)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>clicked</th>\n",
       "      <th>I1</th>\n",
       "      <th>I2</th>\n",
       "      <th>I3</th>\n",
       "      <th>I4</th>\n",
       "      <th>I5</th>\n",
       "      <th>I6</th>\n",
       "      <th>I7</th>\n",
       "      <th>I8</th>\n",
       "      <th>I9</th>\n",
       "      <th>...</th>\n",
       "      <th>C17</th>\n",
       "      <th>C18</th>\n",
       "      <th>C19</th>\n",
       "      <th>C20</th>\n",
       "      <th>C21</th>\n",
       "      <th>C22</th>\n",
       "      <th>C23</th>\n",
       "      <th>C24</th>\n",
       "      <th>C25</th>\n",
       "      <th>C26</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>1382</td>\n",
       "      <td>4</td>\n",
       "      <td>15</td>\n",
       "      <td>2</td>\n",
       "      <td>181</td>\n",
       "      <td>...</td>\n",
       "      <td>e5ba7672</td>\n",
       "      <td>f54016b9</td>\n",
       "      <td>21ddcdc9</td>\n",
       "      <td>b1252a9d</td>\n",
       "      <td>07b5194c</td>\n",
       "      <td>0</td>\n",
       "      <td>3a171ecb</td>\n",
       "      <td>c5c50484</td>\n",
       "      <td>e8b83407</td>\n",
       "      <td>9727dd16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>44</td>\n",
       "      <td>1</td>\n",
       "      <td>102</td>\n",
       "      <td>8</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>...</td>\n",
       "      <td>07c540c4</td>\n",
       "      <td>b04e4670</td>\n",
       "      <td>21ddcdc9</td>\n",
       "      <td>5840adea</td>\n",
       "      <td>60f6221e</td>\n",
       "      <td>0</td>\n",
       "      <td>3a171ecb</td>\n",
       "      <td>43f13e8b</td>\n",
       "      <td>e8b83407</td>\n",
       "      <td>731c3655</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>14</td>\n",
       "      <td>767</td>\n",
       "      <td>89</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>245</td>\n",
       "      <td>...</td>\n",
       "      <td>8efede7f</td>\n",
       "      <td>3412118d</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>e587c466</td>\n",
       "      <td>ad3062eb</td>\n",
       "      <td>3a171ecb</td>\n",
       "      <td>3b183c5c</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>893</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4392</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1e88c74f</td>\n",
       "      <td>74ef3502</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>6b3a5ca6</td>\n",
       "      <td>0</td>\n",
       "      <td>3a171ecb</td>\n",
       "      <td>9117a34a</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>-1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1e88c74f</td>\n",
       "      <td>26b3c7a7</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>21c9516a</td>\n",
       "      <td>0</td>\n",
       "      <td>32c7478e</td>\n",
       "      <td>b34f3128</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 40 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   clicked  I1   I2  I3  I4    I5  I6  I7  I8   I9    ...            C17  \\\n",
       "0        0   1    1   5   0  1382   4  15   2  181    ...       e5ba7672   \n",
       "1        0   2    0  44   1   102   8   2   2    4    ...       07c540c4   \n",
       "2        0   2    0   1  14   767  89   4   2  245    ...       8efede7f   \n",
       "3        0   0  893   0   0  4392   0   0   0    0    ...       1e88c74f   \n",
       "4        0   3   -1   0   0     2   0   3   0    0    ...       1e88c74f   \n",
       "\n",
       "         C18        C19        C20        C21        C22        C23  \\\n",
       "0   f54016b9   21ddcdc9   b1252a9d   07b5194c          0   3a171ecb   \n",
       "1   b04e4670   21ddcdc9   5840adea   60f6221e          0   3a171ecb   \n",
       "2   3412118d          0          0   e587c466   ad3062eb   3a171ecb   \n",
       "3   74ef3502          0          0   6b3a5ca6          0   3a171ecb   \n",
       "4   26b3c7a7          0          0   21c9516a          0   32c7478e   \n",
       "\n",
       "         C24        C25        C26  \n",
       "0   c5c50484   e8b83407   9727dd16  \n",
       "1   43f13e8b   e8b83407   731c3655  \n",
       "2   3b183c5c          0          0  \n",
       "3   9117a34a          0          0  \n",
       "4   b34f3128          0          0  \n",
       "\n",
       "[5 rows x 40 columns]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "sparse_features = ['C' + str(i) for i in range(1, 27)]\n",
    "dense_features = ['I'+str(i) for i in range(1, 14)]\n",
    "data[sparse_features] = data[sparse_features].fillna('-1', )\n",
    "data[dense_features] = data[dense_features].fillna(0,)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 1.Label Encoding for sparse features,and do simple Transformation for dense features\n",
    "for feat in sparse_features:\n",
    "    lbe = LabelEncoder()\n",
    "    data[feat] = lbe.fit_transform(data[feat])\n",
    "mms = MinMaxScaler(feature_range=(0, 1))\n",
    "data[dense_features] = mms.fit_transform(data[dense_features])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2.count #unique features for each sparse field,and record dense feature field name\n",
    "sparse_feature_list = [SingleFeat(feat, data[feat].nunique())for feat in sparse_features]\n",
    "dense_feature_list = [SingleFeat(feat, 0)for feat in dense_features]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 3.generate input data for model\n",
    "train=data\n",
    "train_model_input = [train[feat.name].values for feat in sparse_feature_list] + \\\n",
    "                    [train[feat.name].values for feat in dense_feature_list]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Train on 640000 samples, validate on 160000 samples\n",
      "Epoch 1/10\n",
      " - 866s - loss: 0.4893 - binary_crossentropy: 0.4788 - val_loss: 0.4895 - val_binary_crossentropy: 0.4726\n",
      "Epoch 2/10\n",
      " - 965s - loss: 0.4705 - binary_crossentropy: 0.4433 - val_loss: 0.4993 - val_binary_crossentropy: 0.4684\n",
      "Epoch 3/10\n",
      " - 806s - loss: 0.3729 - binary_crossentropy: 0.3378 - val_loss: 0.5617 - val_binary_crossentropy: 0.5214\n",
      "Epoch 4/10\n",
      " - 813s - loss: 0.3391 - binary_crossentropy: 0.3002 - val_loss: 0.5861 - val_binary_crossentropy: 0.5442\n",
      "Epoch 5/10\n",
      " - 845s - loss: 0.3105 - binary_crossentropy: 0.2722 - val_loss: 0.6124 - val_binary_crossentropy: 0.5724\n",
      "Epoch 6/10\n",
      " - 863s - loss: 0.2942 - binary_crossentropy: 0.2560 - val_loss: 0.6227 - val_binary_crossentropy: 0.5815\n",
      "Epoch 7/10\n",
      " - 833s - loss: 0.2819 - binary_crossentropy: 0.2422 - val_loss: 0.6327 - val_binary_crossentropy: 0.5900\n",
      "Epoch 8/10\n",
      " - 817s - loss: 0.2697 - binary_crossentropy: 0.2289 - val_loss: 0.6677 - val_binary_crossentropy: 0.6240\n",
      "Epoch 9/10\n",
      " - 810s - loss: 0.2580 - binary_crossentropy: 0.2166 - val_loss: 0.6796 - val_binary_crossentropy: 0.6357\n",
      "Epoch 10/10\n",
      " - 810s - loss: 0.2480 - binary_crossentropy: 0.2064 - val_loss: 0.6973 - val_binary_crossentropy: 0.6535\n"
     ]
    }
   ],
   "source": [
    "# 4.Define Model,train,predict and evaluate\n",
    "model = DeepFM({\"sparse\": sparse_feature_list,\"dense\": dense_feature_list}, final_activation='sigmoid')\n",
    "model.compile(\"adam\", \"binary_crossentropy\",metrics=['binary_crossentropy'], )\n",
    "history = model.fit(train_model_input, train[LABEL_COLUMN].values,batch_size=256, epochs=10, verbose=2, validation_split=0.2, )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "读取测试数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_data = pd.read_csv('./data/eval.csv',names=TRAIN_DATA_COLUMNS)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>clicked</th>\n",
       "      <th>I1</th>\n",
       "      <th>I2</th>\n",
       "      <th>I3</th>\n",
       "      <th>I4</th>\n",
       "      <th>I5</th>\n",
       "      <th>I6</th>\n",
       "      <th>I7</th>\n",
       "      <th>I8</th>\n",
       "      <th>I9</th>\n",
       "      <th>...</th>\n",
       "      <th>C17</th>\n",
       "      <th>C18</th>\n",
       "      <th>C19</th>\n",
       "      <th>C20</th>\n",
       "      <th>C21</th>\n",
       "      <th>C22</th>\n",
       "      <th>C23</th>\n",
       "      <th>C24</th>\n",
       "      <th>C25</th>\n",
       "      <th>C26</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>2636</td>\n",
       "      <td>6</td>\n",
       "      <td>9</td>\n",
       "      <td>768</td>\n",
       "      <td>18</td>\n",
       "      <td>1</td>\n",
       "      <td>18</td>\n",
       "      <td>18</td>\n",
       "      <td>...</td>\n",
       "      <td>d4bb7bd8</td>\n",
       "      <td>2804effd</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>723b4dfd</td>\n",
       "      <td>ad3062eb</td>\n",
       "      <td>32c7478e</td>\n",
       "      <td>b34f3128</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>24</td>\n",
       "      <td>3</td>\n",
       "      <td>10003</td>\n",
       "      <td>22</td>\n",
       "      <td>6</td>\n",
       "      <td>4</td>\n",
       "      <td>21</td>\n",
       "      <td>...</td>\n",
       "      <td>8efede7f</td>\n",
       "      <td>7b06fafe</td>\n",
       "      <td>85684dc0</td>\n",
       "      <td>a458ea53</td>\n",
       "      <td>7ae4d78f</td>\n",
       "      <td>0</td>\n",
       "      <td>32c7478e</td>\n",
       "      <td>67a18c8c</td>\n",
       "      <td>2bf691b1</td>\n",
       "      <td>6aba8db0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1477</td>\n",
       "      <td>81</td>\n",
       "      <td>3</td>\n",
       "      <td>43</td>\n",
       "      <td>90</td>\n",
       "      <td>...</td>\n",
       "      <td>e5ba7672</td>\n",
       "      <td>281769c2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>73d06dde</td>\n",
       "      <td>ad3062eb</td>\n",
       "      <td>3a171ecb</td>\n",
       "      <td>aee52b6f</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>42851</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>11</td>\n",
       "      <td>...</td>\n",
       "      <td>e5ba7672</td>\n",
       "      <td>53515e19</td>\n",
       "      <td>21ddcdc9</td>\n",
       "      <td>5840adea</td>\n",
       "      <td>567ed6ad</td>\n",
       "      <td>0</td>\n",
       "      <td>32c7478e</td>\n",
       "      <td>6095f986</td>\n",
       "      <td>ea9a246c</td>\n",
       "      <td>03219b28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>-1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>623</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>12</td>\n",
       "      <td>12</td>\n",
       "      <td>...</td>\n",
       "      <td>8efede7f</td>\n",
       "      <td>88416823</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>ad3062eb</td>\n",
       "      <td>423fab69</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 40 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   clicked  I1    I2  I3  I4     I5  I6  I7  I8  I9    ...            C17  \\\n",
       "0        0   1  2636   6   9    768  18   1  18  18    ...       d4bb7bd8   \n",
       "1        1   0     1  24   3  10003  22   6   4  21    ...       8efede7f   \n",
       "2        0   0     0   2   3   1477  81   3  43  90    ...       e5ba7672   \n",
       "3        1   0     1   3   0  42851  17   0   0  11    ...       e5ba7672   \n",
       "4        1   1    -1   0   0    623   0   5  12  12    ...       8efede7f   \n",
       "\n",
       "         C18        C19        C20        C21        C22        C23  \\\n",
       "0   2804effd          0          0   723b4dfd   ad3062eb   32c7478e   \n",
       "1   7b06fafe   85684dc0   a458ea53   7ae4d78f          0   32c7478e   \n",
       "2   281769c2          0          0   73d06dde   ad3062eb   3a171ecb   \n",
       "3   53515e19   21ddcdc9   5840adea   567ed6ad          0   32c7478e   \n",
       "4   88416823          0          0          0   ad3062eb   423fab69   \n",
       "\n",
       "         C24        C25        C26  \n",
       "0   b34f3128          0          0  \n",
       "1   67a18c8c   2bf691b1   6aba8db0  \n",
       "2   aee52b6f          0          0  \n",
       "3   6095f986   ea9a246c   03219b28  \n",
       "4          0          0          0  \n",
       "\n",
       "[5 rows x 40 columns]"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test_data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_data[sparse_features] = test_data[sparse_features].fillna('-1', )\n",
    "test_data[dense_features] = test_data[dense_features].fillna(0,)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "for feat in sparse_features:\n",
    "    lbe = LabelEncoder()\n",
    "    test_data[feat] = lbe.fit_transform(test_data[feat])\n",
    "mms = MinMaxScaler(feature_range=(0, 1))\n",
    "test_data[dense_features] = mms.fit_transform(test_data[dense_features])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "sparse_feature_list = [SingleFeat(feat, test_data[feat].nunique())for feat in sparse_features]\n",
    "dense_feature_list = [SingleFeat(feat, 0)for feat in dense_features]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_model_input = [test_data[feat.name].values for feat in sparse_feature_list] + \\\n",
    "                   [test_data[feat.name].values for feat in dense_feature_list]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred_ans = model.predict(test_model_input, batch_size=256)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "test LogLoss 1.0859\n",
      "test AUC 0.5678\n"
     ]
    }
   ],
   "source": [
    "print(\"test LogLoss\", round(log_loss(test_data[LABEL_COLUMN].values, pred_ans), 4))\n",
    "print(\"test AUC\", round(roc_auc_score(test_data[LABEL_COLUMN].values, pred_ans), 4))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
